package com.znyj.servlet.aes;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * Created by gaoliwei02 on 2017/9/4.
 */
@Component
public class MsgCryptTool implements InitializingBean {
    private MsgCrypt msgCrypt = null;

    @Override
    public void afterPropertiesSet() throws Exception {
        msgCrypt = new MsgCrypt("tokenNoUse", "5lanyIYz49uJ3iqaKp8Zvd2j9xJ7rxZKRHBjcQeXBoq");
    }

    public String decryptApi(String getJsonString) throws AesException {
        return msgCrypt.decryptMsg(getJsonString);
    }

    public String encryptApi(String sendJsonString) throws AesException {
        return msgCrypt.encryptMsg(sendJsonString);
    }
}
